/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.producer;

/**
 *
 * @author Rakev
 */
public class NullPermittedProducerDecorator<F, T> implements Producer<F, T> {

    private Producer<F, T> decoratedProducer;

    public NullPermittedProducerDecorator(Producer<F, T> decoratedProducer) {
        this.decoratedProducer = decoratedProducer;
    }

    @Override
    public T produce(F fromObject) {
        if (fromObject != null) {
            return decoratedProducer.produce(fromObject);
        } else {
            return null;
        }
    }
}
